/**
*删除左右两端的空格
*/
String.prototype.trim=function(){   
  	return this.replace(/(^\s*)|(\s*$)/g, '');
}  
/**
*删除左边的空格
*/
String.prototype.ltrim=function()
{
  return this.replace(/(^s*)/g,'');
}
/**
*删除右边的空格
*/
String.prototype.rtrim=function()
{
  return this.replace(/(s*$)/g,'');
}

function checkTeamName() {
	var teamName = document.getElementById("teamName").value;
	if(teamName.trim()==""||teamName==null){
		str = "&nbsp;队伍名称不能为空";
		document.getElementById("teamName.info").innerHTML=str;
	}else{
		str = "";
		document.getElementById("teamName.info").innerHTML=str;
		return true;
	}
	return false;
}

function checkMember(){
	var teamLeader = document.getElementById("teamLeader").value;
	var member1 = document.getElementById("member1").value;
	var member2 = document.getElementById("member2").value;
	if(teamLeader == member1 || teamLeader == member2 || member1 == member2){
		str = "&nbsp;成员不足三个，不允许组队";
		document.getElementById("member.info").innerHTML=str;
	}else{
		str = "";
		document.getElementById("member.info").innerHTML=str;
		return true;
	}
	return false;
}

//最后检查表单是否合格
function testForm(){
	if(!checkTeamName()||!checkMember()){
		return false;
	}
	return true;
}

